14. Exercise: Create Firebase Messaging Service
19 Firebase Messaging Service
Create Firebase Messaging Service
Let's add the code to process data messages. To do this, you'll need to create a FirebaseMessagingService. Follow the TODOs in the code to complete this exercise. Once you're done, you should be able to send a Squawk to a Single Device from the Squawker server. Remember that you'll need your server key, which you can get from the Firebase Console as shown in this video.
Exercise Code
Exercise: TFCM.04-Exercise-AddFirebaseMessagingService
If you need it, here's an example of getting data from a RemoteMessage object:
java
Map<String, String> data = remoteMessage.getData();
String author = data.get("author");
Part of this exercise involves interacting with content providers and creating a notification. These are two topics we've covered previously. If you're not familiar with these concepts you can learn more about notifications here and interacting with content providers here.
Task Description:
Complete the TODOs and send your first data message to Squawker!
Task Feedback:
Stellar work! You should now be able to receive a message from the Squawker server
Solution: [TFCM.04-Solution-AddFirebaseMessagingService][Diff]